<script>
    function choseItem() {
        var v = "";
        var check_item = document.frm.item;
        for (i = 0; i < check_item.length; i++) {
            if (check_item[i].checked) {
                v += "," + check_item[i].value;
            }
            document.frm.txt.value = v.replace(/^,{1}/, "");
        }
    }
    function foo() {
        window.close();
        window.opener.document.getElementById("txt0").value = document.getElementById("txt").value
    }
</script>
<body>
<form name=frm>
    <input type=checkbox name=item value=1 onclick="choseItem();">a
    <input type=checkbox name=item value=2 onclick="choseItem();">b
    <input type=checkbox name=item value=3 onclick="choseItem();">c
    <input type=checkbox name=item value=4 onclick="choseItem();">d
    <input type=text name="txt" id="txt">
</form>
<input type=button value="关闭" onclick="foo();">
</body>
